import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.3

Rectangle {
    id:dataRefineControler
    width: 300
    height: 200
    color: "#CC333333"
    radius: 5
    visible: false
    transform: Scale { origin.x: 0; origin.y: 0; xScale: root.x_enl-0.3;yScale: root.y_enl-0.3}
    Text{
        x: 20
        y: 20
        width: 300
        height: 30
        text:"监测数据精化"

        color: "white";
    }

    Rectangle{
        x:10
        y:40
        width: 280
        height: 1
        radius: 1
        color: "#FFCCCCCC"
    }


    ColumnLayout {
        x: 20
        y: 49
        width: 250
        height: 140

        RowLayout {

            y:90
            x:20
            width: 250
            height: 30
            Text{
                width: 65
                color: "white";
                text:"插值项:"
                anchors.left: parent.left
                anchors.leftMargin: 0
            }
            Item{

                width: 60
                height: 25
                ComboBox {
                    id:interPolationItem
                    width: 85

                    anchors.left: parent.left
                    anchors.leftMargin: 0
                    //anchors.right: parent.right
                    currentIndex: 0
                    model:["AQI","PM25","PM10","SO2","NO2","CO","O3"];
                    style:ComboBoxStyle{
                        drowDownButtonWidth: 5
                        dropDownButtonWidth: 5
                        textColor: "#FFFFFF"
                        selectedTextColor: "#CCCCCCCC"
                        selectionColor:"#CC333333"
                        background:Rectangle {

                            color: "#CC333333"
                            radius: 2
                            implicitWidth: 100
                            implicitHeight: 30
                            border.color: "#FFCCCCCC"
                            Image {
                                id: imageDropdown
                                width: height
                                height: 0.8 * parent.height
                                sourceSize.height: 30
                                sourceSize.width: 30
                                anchors.right: parent.right
                                anchors.rightMargin: 5
                                anchors.verticalCenter: parent.verticalCenter
                                fillMode: Image.Stretch
                                source: "./切图/查询定位/下拉触碰.png"
                            }
                        }

                    }
                }
            }
        }
        RowLayout {

            y:90
            x:20
            width: 250
            height: 30
            Text{
                width: 65
                color: "white";
                text:"分辨率:"
                anchors.left: parent.left
                anchors.leftMargin: 0
            }
            Item{
                id: item1
                width: 60
                height: 25
                ComboBox {
                    id:resLevel
                    width: 65

                    anchors.left: parent.left
                    anchors.leftMargin: 0
                    //anchors.right: parent.right
                    currentIndex: 0
                    model: [1,2,4]
                    style:ComboBoxStyle{
                        drowDownButtonWidth: 5
                        dropDownButtonWidth: 5
                        textColor: "#FFFFFF"
                        selectedTextColor: "#CCCCCCCC"
                        selectionColor:"#CC333333"
                        background:Rectangle {

                            color: "#CC333333"
                            radius: 2
                            implicitWidth: 100
                            implicitHeight: 30
                            border.color: "#FFCCCCCC"
                            Image {
                                id: imgDropdown
                                width: height
                                height: 0.8 * parent.height
                                sourceSize.height: 30
                                sourceSize.width: 30
                                anchors.right: parent.right
                                anchors.rightMargin: 5
                                anchors.verticalCenter: parent.verticalCenter
                                fillMode: Image.Stretch
                                source: "./切图/查询定位/下拉触碰.png"
                            }
                        }


                    }
                }
            }

            Text{
                width: 65
                color: "white";
                text:" 公里 "
                anchors.left: parent.left
                anchors.leftMargin: 135
            }


        }

        RowLayout {

            width: 250
            height: 30
            z: 1
            Text{
                width: 65
                color: "white";
                text:" 日期: "
                horizontalAlignment: Text.AlignHCenter
            }
            MyCalendar{
                id:myCalendar
                x: 70
                implicitWidth:175
                dateValue: (new Date()).toLocaleString(Qt.locale(), "yyyy-MM-dd")
                onDateValueChanged: {
                    text = dateValue
                }
            }
        }

        //        RowLayout {
        //            id: rowLayout1
        //            width: 250
        //            height: 30
        //            z: 0

        //            Button {
        //                id: button1
        //                width: 90

        //                anchors.left: parent.left
        //                anchors.leftMargin: 30

        //                style: ButtonStyle{
        //                    label: Text{
        //                        text: qsTr("确定")
        //                        color: "white"
        //                        horizontalAlignment:Text.AlignHCenter
        //                    }
        //                    background: Rectangle {
        //                        color: "#CC333333"
        //                        radius: 2

        //                        implicitWidth: 90
        //                        implicitHeight: 30
        //                        border.color: "#FFCCCCCC"
        //                        border.width: 1
        //                    }

        //                }
        //            }

        //            Button {
        //                id: button2
        //                width: 90
        //                anchors.centerIn: parent
        //                anchors.left: parent.left
        //                anchors.leftMargin: 150
        //                style: ButtonStyle{
        //                    label: Text{

        //                        text: qsTr("取消")
        //                        color: "white"
        //                        horizontalAlignment:Text.AlignHCenter

        //                    }
        //                    background: Rectangle {
        //                        color: "#CC333333"
        //                        radius: 2
        //                        implicitWidth: 90
        //                        implicitHeight: 30
        //                        border.color: "#FFCCCCCC"
        //                        border.width: 1
        //                    }

        //                }
        //                MouseArea {
        //                    anchors.fill: parent
        //                    hoverEnabled: true
        //                    onEntered: {
        //                        parent.color = "#FF888888"
        //                        cursorShape = Qt.PointingHandCursor
        //                    }
        //                    onExited: {
        //                        parent.color = "#DDCCCCCC"
        //                        cursorShape = Qt.ArrowCursor
        //                    }
        //                    onClicked: {
        //                        windControler.visible = false
        //                    }
        //                }

        //            }

        //        }
        RowLayout {

            width: 250
            height: 30
            Rectangle {
                id: rectangle1
                width: 60
                height: 25
                color: "#DDCCCCCC"
                radius: 3
                visible: true
                anchors.left: parent.left
                anchors.leftMargin: 21
                Text{
                    anchors.centerIn: parent
                    text:"确定"
                }
                MouseArea {
                    anchors.right: parent.right
                    anchors.rightMargin: 0
                    anchors.left: parent.left
                    anchors.leftMargin: 0
                    anchors.bottom: parent.bottom
                    anchors.bottomMargin: 0
                    anchors.top: parent.top
                    anchors.topMargin: 0
                    hoverEnabled: true
                    onEntered: {
                        // parent.color = "#FF888888"
                        cursorShape = Qt.PointingHandCursor
                    }
                    onExited: {
                        //parent.color = "#DDCCCCCC"
                        cursorShape = Qt.ArrowCursor
                    }
                    onClicked: {
                        var Res = resLevel.currentText;
                        var date = myCalendar.text;
                        var interPolation = interPolationItem.currentText;
                        app.slotShowDataRefine(Res,date,interPolation);
                    }
                }
            }

            Item{
                width: 30
                height: 25
            }
            Rectangle {
                width: 60
                height: 25
                color: "#DDCCCCCC"
                radius: 3
                anchors.left: parent.left
                anchors.leftMargin: 164
                Text{
                    anchors.centerIn: parent
                    text:"关闭"
                }
                MouseArea {
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        //  parent.color = "#FF888888"
                        cursorShape = Qt.PointingHandCursor
                    }
                    onExited: {
                        // parent.color = "#DDCCCCCC"
                        cursorShape = Qt.ArrowCursor
                    }
                    onClicked: {
                        dataRefineControler.visible = false
                        app.slotCloseDataRefine();
                    }
                }
            }
        }

    }


}
